<!--代码逻辑和样式库-->
<script src="./search-criteria.component.js"></script>
<style src="./search-criteria.scss" lang="scss" scoped></style>

<template>
  <div>
    <!-- 搜索条件 -->
    <el-divider content-position="left"><span class="font-weight">筛选条件</span></el-divider>
    <el-form :inline="true">
      <el-form-item>
        <el-select :disabled="!isAdmin && userInfo.province != ''" v-model="searchCriteria.selectedProvince" placeholder="请选择省" clearable @change="setSelectedProvince()">
          <el-option :label="option" :value="option" v-for="(option, index) in provinceList" :key="index"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select :disabled="!isAdmin && userInfo.city != ''" v-model="searchCriteria.selectedCity" placeholder="请选择市" clearable @change="setSelectedCity()">
          <el-option :label="option" :value="option" v-for="(option, index) in cityList" :key="index"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select :disabled="!isAdmin && userInfo.village != ''" v-model="searchCriteria.selectedCountry" placeholder="请选择区/县" clearable @change="setSelectedCountry()">
          <el-option :label="option" :value="option" v-for="(option, index) in village" :key="index"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select :disabled="!isAdmin && userInfo.prefecture != ''" v-model="searchCriteria.selectedCountrySide" placeholder="请选择乡" clearable @change="setSelectedCooperative()">
          <el-option :label="option" :value="option" v-for="(option, index) in workAddress" :key="index"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList'">
        <el-select :disabled="userInfo.usertype == '1'" v-model="searchCriteria.selectedFarm" placeholder="请选择合作社" clearable>
          <el-option :label="option" :value="option" v-for="(option, index) in farms" :key="index"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList' && currentPageKey != 'skipOrder'"">
        <el-select v-model="searchCriteria.selectedEquipType" placeholder="请选择类型" clearable>
          <el-option :label="option" :value="option" v-for="(option, index) in typeList" :key="index"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList' && currentPageKey != 'skipOrder'"">
        <el-input v-model="searchCriteria.deviceID" placeholder="请输入设备ID" clearable></el-input>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList' && currentPageKey != 'skipOrder'"">
        <el-input v-model="searchCriteria.carNum" placeholder="请输入车牌号" clearable></el-input>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList' && currentPageKey != 'skipOrder'"">
        <el-input v-model="searchCriteria.carOwner" placeholder="请输入车主电话" clearable></el-input>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList' && currentPageKey != 'skipOrder'"">
        <el-date-picker v-model="searchCriteria.startTime" type="date" placeholder="选择开始日期" value-format="yyyyMMdd">
        </el-date-picker>
      </el-form-item>
      <el-form-item v-if="currentPageKey != 'landList' && currentPageKey != 'skipOrder'">
        <el-date-picker v-model="searchCriteria.endTime" type="date" placeholder="选择结束日期" value-format="yyyyMMdd">
        </el-date-picker>
      </el-form-item>
    </el-form>
    <el-row :gutter="20">
      <el-col :span="24">
        <el-button type="primary" icon="el-icon-search" @click="search(true)">查询</el-button>
        <el-button type="success" icon="el-icon-download" @click="exportRecords()">导出</el-button>
        <el-button type="warning" icon="el-icon-refresh" @click="search(false)">重置</el-button>
      </el-col>
    </el-row>
  </div>
</template>
